
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>

<HEAD>
   <TITLE>dp2hx_c</TITLE>
</HEAD>

<BODY style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<A name="TOP"></A>

<table style="text-align: left; margin-left: auto; margin-right: auto; width: 800px;"
 border="0" cellpadding="5" cellspacing="2">
  <tbody>
    <tr>
      <td style="background-color: rgb(153, 153, 153); vertical-align: middle; text-align: center;">
      <div align="right"> 
      <small><small><a href="index.html">Index Page</a></small></small>
      </div>
      <b>dp2hx_c</b> </td>
    </tr>

    <tr>
      <td style="vertical-align: top;">

<small><div align="center">
<A HREF="index.html#A">A</A>&nbsp;
<A HREF="index.html#B">B</A>&nbsp;
<A HREF="index.html#C">C</A>&nbsp;
<A HREF="index.html#D">D</A>&nbsp;
<A HREF="index.html#E">E</A>&nbsp;
<A HREF="index.html#F">F</A>&nbsp;
<A HREF="index.html#G">G</A>&nbsp;
<A HREF="index.html#H">H</A>&nbsp;
<A HREF="index.html#I">I</A>&nbsp;
<A HREF="index.html#J">J</A>&nbsp;
<A HREF="index.html#K">K</A>&nbsp;
<A HREF="index.html#L">L</A>&nbsp;
<A HREF="index.html#M">M</A>&nbsp;
<A HREF="index.html#N">N</A>&nbsp;
<A HREF="index.html#O">O</A>&nbsp;
<A HREF="index.html#P">P</A>&nbsp;
<A HREF="index.html#Q">Q</A>&nbsp;
<A HREF="index.html#R">R</A>&nbsp;
<A HREF="index.html#S">S</A>&nbsp;
<A HREF="index.html#T">T</A>&nbsp;
<A HREF="index.html#U">U</A>&nbsp;
<A HREF="index.html#V">V</A>&nbsp;
<A HREF="index.html#W">W</A>&nbsp;
<A HREF="index.html#X">X</A>&nbsp;
</div></small>
       <br>
       <table style="text-align: left; width: 60%; margin-left: auto; margin-right: auto;"
       border="0" cellspacing="2" cellpadding="2">
        <tbody>
          <tr>
            <td style="width: 50%; text-align: center;">
            <small>
              <a href="#Procedure">Procedure<br></a>
              <a href="#Abstract">Abstract<br></a>
              <a href="#Required_Reading">Required_Reading<br></a>
              <a href="#Keywords">Keywords<br></a>
              <a href="#Brief_I/O">Brief_I/O<br></a>
              <a href="#Detailed_Input">Detailed_Input<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Detailed_Output">Detailed_Output<br></a>
              <a href="#Parameters">Parameters<br></a>
              <a href="#Exceptions">Exceptions<br></a>
              <a href="#Files">Files<br></a>
              <a href="#Particulars">Particulars<br></a>
              <a href="#Examples">Examples<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Restrictions">Restrictions<br></a>
              <a href="#Literature_References">Literature_References<br></a>
              <a href="#Author_and_Institution">Author_and_Institution<br></a>
              <a href="#Version">Version<br></a>
              <a href="#Index_Entries">Index_Entries<br></a>
             </small>
            </td>
          </tr>
        </tbody>
</table>

<h4><a name="Procedure">Procedure</a></h4>
<PRE>
   void dp2hx_c ( SpiceDouble   number,
                  SpiceInt      lenout,
                  SpiceChar   * string,
                  SpiceInt    * length
                 )

</PRE>
<h4><a name="Abstract">Abstract</a></h4>
<PRE>
   Convert a double precision number to an equivalent character
   string using base 16 ``scientific notation.''
</PRE>
<h4><a name="Required_Reading">Required_Reading</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Keywords">Keywords</a></h4>
<PRE>
   ALPHANUMERIC
   CONVERSION


</PRE>
<h4><a name="Brief_I/O">Brief_I/O</a></h4>
<PRE>
   Variable  I/O  Description
   --------  ---  --------------------------------------------------
   number     I   D.p. number to be converted.
   lenout     I   Available space for output string 'string'.
   string     O   Equivalent character string, left justified.
   length     O   Length of the character string produced.
</PRE>
<h4><a name="Detailed_Input">Detailed_Input</a></h4>
<PRE>
   number   The double precision number to be converted to a
            character string representation.

   lenout   is the maximum length of the output 'string'. The value
            defined by lenout should be one plus the value large 
            enough to hold any possible output.
</PRE>
<h4><a name="Detailed_Output">Detailed_Output</a></h4>
<PRE>
   string   The character string produced by this routine that
            represents 'number' in base 16 ``scientific notation,''
            e.g.:

               672.0 = '2A^3' = ( 2/16 + 10/( 16**2 ) ) * 16**3

            and

               -11.0 = '-B^1' = - ( 11/16 ) * 16**1.

            The following table describes the character set used to
            represent the hexadecimal digits and their corresponding
            values.

                 Character    Value         Character    Value
                 ---------    ------        ---------    ------
                   '0'         0.0D0          '8'         8.0D0
                   '1'         1.0D0          '9'         9.0D0
                   '2'         2.0D0          'A'        10.0D0
                   '3'         3.0D0          'B'        11.0D0
                   '4'         4.0D0          'C'        12.0D0
                   '5'         5.0D0          'D'        13.0D0
                   '6'         6.0D0          'E'        14.0D0
                   '7'         7.0D0          'F'        15.0D0

            The caret, or hat, character, '^', is used to distinguish 
            the exponent.

            The plus sign, '+', and the minus sign, '-' have the expected 
            meanings.

            In order to obtain the entire character string produced
            by this routine, the output character string should be
            at least N characters long, where


                      # of bits per double precision mantissa + 3
            N = 3 + ----------------------------------------------
                                          4

                      # of bits per double precision exponent + 3
                  + ---------------------------------------------- .
                                          4

            There should be one character position for the sign of
            the mantissa, one for the sign of the exponent, one for
            the exponentiation character, and one for each
            hexadecimal digit that could be produced from a mantissa
            and an exponent.

            The following table contains minimum output string
            lengths necessary to obtain the complete character
            string produced by this routine for some typical
            implementations of double precision numbers.

            Double precision number
            Size Mantissa Exponent    Minimum output string length
            bits   bits     bits
            ---- -------- --------    ----------------------------
            64   48       15          3 + 12 + 4 = 19
            64   55+1     8           3 + 14 + 2 = 19 (VAX)
            64   52       11          3 + 13 + 3 = 19 (IEEE)

            The base 16 ``scientific notation'' character string
            produced by this routine will be left justified and
            consist of a contiguous sequence of characters with one
            of the following formats:

                (1)   h h h h  ... h ^H H  ... H
                       1 2 3 4      n  1 2      m

                (2)   -h h h h  ... h ^H H  ... H
                        1 2 3 4      n  1 2      m

                (3)   h h h h  ... h ^-H H  ... H
                       1 2 3 4      n   1 2      m

                (4)   -h h h h  ... h ^-H H  ... H
                        1 2 3 4      n   1 2      m

            where

               h   and  H   denote hexadecimal digits
                i        j

               '^'          denotes exponentiation ( base 16 )

            and

               '+' and '-'  have their usual interpretations.

   length   the length of the base 16 ``scientific notation'' character
            'string' returned by this routine.
</PRE>
<h4><a name="Parameters">Parameters</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Exceptions">Exceptions</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Files">Files</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Particulars">Particulars</a></h4>
<PRE>
     This routine converts a double precision number into an equivalent
     character string using a base 16 ``scientific notation.'' This
     representation allows the full precision of a number to be placed
     in a format that is suitable for porting or archival storage.

     This routine is one of a pair of routines which are used to
     perform conversions between double precision numbers and
     an equivalent base 16 ``scientific notation'' character string
     representation:

        <b>dp2hx_c</b> -- Convert a double precision number into a base 16
                   ``scientific notation'' character string.

        <a href="hx2dp_c.html">hx2dp_c</a> -- Convert a base 16 ``scientific notation''
                   character string into a double precision number.
</PRE>
<h4><a name="Examples">Examples</a></h4>
<PRE>
   The following input and output argument values illustrate the
   action of <b>dp2hx_c</b> for various input values of 'number'.

   Note: The hat or caret, '^', signals an exponent.

      number             string                         length
      -----------------  -----------------------------  ------
           2.0D-9         89705F4136B4A6^-7             17
           1.0D0          1^1                           3
          -1.0D0         -1^1                           4
        1024.0D0          4^3                           3
       -1024.0D0         -4^3                           4
      521707.0D0          7F5EB^5                       7
          27.0D0          1B^2                          4
           0.0D0          0^0                           3
</PRE>
<h4><a name="Restrictions">Restrictions</a></h4>
<PRE>
   The maximum number of characters permitted in the output string
   is specified by the variable 'lenout'.
</PRE>
<h4><a name="Literature_References">Literature_References</a></h4>
<PRE>
   None.
</PRE>
<h4><a name="Author_and_Institution">Author_and_Institution</a></h4>
<PRE>
   K.R. Gehringer   (JPL)
</PRE>
<h4><a name="Version">Version</a></h4>
<PRE>
   CSPICE Version 1.0.0, 10-APR-2010 (EDW)
</PRE>
<h4><a name="Index_Entries">Index_Entries</a></h4>
<PRE>
   convert d.p. to signed normalized hexadecimal string
   convert d.p. number to encoded d.p. number
   convert d.p. to base 16 scientific notation
</PRE>
<h4>Link to routine dp2hx_c source file <a href='../../../src/cspice/dp2hx_c.c'>dp2hx_c.c</a> </h4>

      </td>
    </tr>
  </tbody>
</table>

   <pre>Wed Jun  9 13:05:21 2010</pre>

</body>
</html>

